<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Firefox Quirks</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<link rel="stylesheet" href="http://code.jquery.com/qunit/qunit-git.css" type="text/css" />
<script src="http://code.jquery.com/qunit/qunit-git.js"></script>
<script src="qunit/connector.js"></script>
<script type="text/javascript" src="qunit/runner.js"></script>
<script type="text/javascript" src="js/utils.js"></script>
<script type="text/javascript" src="js/tiny_mce_loader.js"></script>
<script type="text/javascript" src="js/dsl/dsl.js"></script>
<script type="text/javascript" language="JavaScript" src="jsrobot/robot.js"></script>
<script>
var editor;

QUnit.config.reorder = false;
QUnit.config.autostart = false;

module("Quirks Tests", {
	autostart: false,
	setup: function() {
		window.queue = new dsl.Queue();
	}
});

if (tinymce.isGecko) {
	asyncTest('Remove hr between p with backspace', 1, function() {
		setTimeout(function() {
			editor.setContent('<p>one</p><hr /><p id="a">two</p>');
			setSelection('#a', 0);
			editor.focus();
			robot.type(8, false, function() {
				var expected = '<p>one</p><p id="a">two</p>';
				var actual = editor.getContent({ format: 'raw' });
				equal(actual, expected);
				start();
			}, editor.getBody());
		}, 100);
	});

	test('Add BR element at end of paragraphs with single link', function() {
		editor.setContent('<p><b><a href="#">x</a></b></p>');
		equal(editor.getBody().innerHTML, '<p><strong><a href="#" data-mce-href="#">x</a></strong><br data-mce-bogus="1"></p>');
	});
} else {
	test('ignored', function() {
		ok(true, "Tests ignored since the browser isn't Gecko.");
	});
}

function initTinyFunction() {
	tinyMCE.init({
		mode : "exact",
		elements : "elm1",
		init_instance_callback : function(ed) {
			editor = ed;
		}
	});
}
</script>
</head>
<body>
	<h1 id="qunit-header">Firefox Quirks</h1>
	<h2 id="qunit-banner"></h2>
	<div id="qunit-testrunner-toolbar"></div>
	<h2 id="qunit-userAgent"></h2>
	<ol id="qunit-tests"></ol>
	<div id="content">
		<textarea id="elm1" name="elm1"></textarea>
		<div>
			<a href="javascript:alert(tinymce.EditorManager.get('elm1').getContent({format : 'raw'}));">[getRawContents]</a>
			<a href="javascript:alert(tinymce.EditorManager.get('elm1').getContent());">[getContents]</a>
		</div>
	</div>
    <script>
	initWhenTinyAndRobotAreReady(initTinyFunction);
	</script>
</body>
</html>
